package dbutil

import (
	"fmt"
	"strings"
)

func TakePlaceHolder(sql, placeHolder string, count int) string {
	var ps []string
	for n := 0; n < count; n++ {
		ps = append(ps, "?")
	}
	return strings.ReplaceAll(sql, placeHolder, strings.Join(ps, ","))
}

func TakeDollarPlaceHolder(sql, placeHolder string, count int, fromIndex int) string {
	var ps []string
	for n := 0; n < count; n++ {
		fromIndex++
		ps = append(ps, fmt.Sprintf("$%d", fromIndex))

	}
	return strings.ReplaceAll(sql, placeHolder, strings.Join(ps, ","))
}
